package com.wei.controller;

import com.wei.result.R;
import com.wei.service.IReviewService;
import com.wei.vo.ReviewVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 评论表 前端控制器
 * </p>
 *
 * @author 蔡徐坤
 * @since 2025-07-28
 */
@RestController
@RequiredArgsConstructor

@Api(tags = "评论")
@RequestMapping("/api/review")
public class ReviewController {

    private final IReviewService reviewService;

    @ApiOperation("根据产品ID查询评论列表")
    @GetMapping("/list/{productId}")
    public R<List<ReviewVO>> list(@PathVariable("productId") Long productId) {
        return R.ok(reviewService.listReviewsByProductId(productId));
    }

}
